package com.solr;

import org.apache.solr.client.solrj.impl.HttpSolrClient;

/**
 * Created by thinkjoy on 2017/6/30.
 */
public class SolrServer {
    private static HttpSolrClient server=null;
    private static  String url="http://localhost:8983/solr/my_core";

    public static HttpSolrClient getServer(){
        if(server==null){
            server=new HttpSolrClient(url);
            server.setDefaultMaxConnectionsPerHost(1000);
            server.setMaxTotalConnections(10000);//最大连接数
            server.setConnectionTimeout(60000);//连接超时时间
            server.setSoTimeout(60000);//读数据超时时间
            server.setFollowRedirects(false);//是否遵循重定向
            server.setAllowCompression(true);//是否允许压缩
        }
        return server;
    }
}
